﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _4_1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void textBox1_Leave(object sender, EventArgs e)
        {
            try
            {
                int memory = int.Parse(textBox1.Text);
            }
            catch
            {
                MessageBox.Show("内存输入有误，请输入数字！", "输入错误");
                textBox1.Text = "";
                textBox1.Focus();
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            textBox2.Clear();

            
            textBox2.AppendText(listBox1.SelectedItem.ToString() + Environment.NewLine);

            if (radioButton2.Checked) 
                textBox2.AppendText("台式机" + Environment.NewLine);
            else if (radioButton1.Checked) 
                textBox2.AppendText("笔记本" + Environment.NewLine);
            else if (radioButton3.Checked) 
                textBox2.AppendText("平板电脑" + Environment.NewLine);

            
            textBox2.AppendText(textBox1.Text + "G内存" + Environment.NewLine);

          
            if (radioButton4.Checked) 
                textBox2.AppendText("酷睿" + Environment.NewLine);
            else if (radioButton5.Checked) 
                textBox2.AppendText("奔腾" + Environment.NewLine);
            else if (radioButton6.Checked)
                textBox2.AppendText("AMD" + Environment.NewLine);

          
            if (checkBox1.Checked) 
                textBox2.AppendText("移动硬盘" + Environment.NewLine);
            if (checkBox2.Checked) 
                textBox2.AppendText("外置DVD光驱" + Environment.NewLine);
            if (checkBox3.Checked) 
                textBox2.AppendText("无线键鼠套装" + Environment.NewLine);
        }
    }
}
        